package com.shigen.demo.base;

import java.util.Arrays;

/**
 * 字符串案例
 *
 * @author shigenfu
 * @date 2022/5/28 9:24 上午
 */
public class StringDemo {

  public static void main(String[] args) {
    String a = "111";

    String _a;
    String $;
    String v1;

    char c = 'c';
    System.out.println("hello world");

    short s = 5;
    System.out.println(Short.MAX_VALUE);


    int aa = 0b101;
    // 二进制转十进制
    int bb = 0x123;
    Integer cc = null;
    cc = 15;
    System.out.println(aa + " " + bb + " " + cc) ;

    System.out.println(Integer.toHexString(cc));
    System.out.println(Integer.toOctalString(cc));
    System.out.println(Integer.toBinaryString(cc));

    // Scanner scanner = new Scanner(System.in);
    // int i = scanner.nextInt();
    // System.out.println(i);
    //
    // System.out.println(scanner.next());

    String [] arr1 = new String[]{"aa","bb","cc"};
    String [] arr2 = new String[arr1.length];

    arr2 = Arrays.copyOf(arr1, arr1.length);
    System.out.println(Arrays.toString(arr2));

    System.out.println(Arrays.equals(arr1, arr2));

    Arrays.fill(arr1 ,"shigen");
    System.out.println(Arrays.toString(arr1));

    arr1[2] = "gen";
    String [] arr3 = arr1;

    arr3[0] = null;

    System.out.println(Arrays.toString(arr3));
    System.out.println(Arrays.toString(arr1));

    // int j =0;
    // for (int i = 0; i < 10; i++) {
    //   j = j++;
    //   System.out.println(j);
    // }
    // System.out.println("j = " + j);

    String str1 = "aaa";
    String str2 = "aaa";
    System.out.println(str1 == str2);
    System.out.println(str1.equals(str2));
    System.out.println(str1.hashCode() + "   " + str2.hashCode());
  }

}
